package day05;

import java.util.Arrays;

public class ArrayDemo {
    public static void main(String[] args) {

        //int[] a = new  int[10];
        /*for (int i = 0; i <a.length ; i++) {
            a[i] = 100;
            System.out.println(a[i]);*/
        //}
        /*int[] arr = new int[10];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = (int) (Math.random() * 100);
            System.out.println(arr[i]);
        }
        System.out.println("排序后");
        Arrays.sort(arr);
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
        System.out.println("倒着排序后");
        for (int i = arr.length - 1; i >= 0; i--) {
            System.out.println(arr[i]);
        }*/

        int[] a = {1, 2, 3, 5, 4, 6, 9, 8, 7};
        a = Arrays.copyOf(a,a.length+3);
        for (int i = 0; i <a.length ; i++) {
            System.out.println(a[i]);
        }
















      /*  int[] a = new int[5];
        int[] b = {2, 5, 8};
        int[] c = new int[]{2, 5, 8,};
        int[] d;
        //d = {2,5,8};
        d = new int[]{2, 5, 8};
        int[] d1 = new int[5];
        int[] d2 = {2, 6, 8};
        int[] d3 = new int[]{2, 5, 7};
        for (int i = 0; i < b.length; i++) {
            System.out.println(b[i]);
        }
        int[] in = {2, 3, 6, 5, 4, 1, 2, 1, 2};
        in[5] = 100;
        //in[100] = 100;//ArrayIndexOutOfBoundsException数组下标越界异常
        for (int j = 0; j < in.length; j++) {
             System.out.println(in[j]);
        }*/

    }
}
